/*
Navicat MySQL Data Transfer

Source Server         : localhost
Source Server Version : 50624
Source Host           : localhost:3306
Source Database       : cloud_log

Target Server Type    : MYSQL
Target Server Version : 50624
File Encoding         : 65001

Date: 2018-06-17 09:54:52
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for t_log
-- ----------------------------
DROP TABLE IF EXISTS `t_log`;
CREATE TABLE `t_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(50) NOT NULL COMMENT '用户名',
  `module` varchar(100) NOT NULL COMMENT '模块名',
  `params` text COMMENT '方法参数',
  `remark` text COMMENT '备注',
  `flag` tinyint(1) NOT NULL COMMENT '是否成功(1成功，0失败)',
  `createTime` datetime NOT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`),
  KEY `username` (`username`),
  KEY `createTime` (`createTime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='日志表';



oracle
CREATE TABLE t_log (
  id number(11) NOT NULL  PRIMARY KEY,
  username varchar(50) NOT NULL,
  module varchar(100) NOT NULL,
  params varchar2(4000),
  remark varchar2(4000),
  flag number(1) NOT NULL,
  createTime date NOT NULL
)

comment on table t_log is '日志表';
comment on column t_log.username is '用户名';
comment on column t_log.module is '模块名';
comment on column t_log.params is '方法参数';
comment on column t_log.remark is '备注';
comment on column t_log.flag is '是否成功(1成功，0失败)';
comment on column t_log.createTime is '创建时间';


CREATE SEQUENCE t_log_seq INCREMENT BY 1 START WITH 1 NOMAXVALUE NOCYCLE NOCACHE;
CREATE OR REPLACE TRIGGER t_log_TRG
  BEFORE INSERT ON t_log
  FOR EACH ROW  WHEN (new.id is null)
BEGIN
  SELECT t_log_seq.NEXTVAL INTO :NEW.id FROM DUAL;
END;